//
//  fristView.m
//  HGY
//
//  Created by lanou3g on 15/10/27.
//  Copyright (c) 2015年 顾成辉. All rights reserved.
//

#import "fristView.h"

@implementation fristView

{
    NSInteger  width;
    NSInteger height;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self size];
        [self addView];
    }
    return self;
}

- (void)size
{
    if (kScreenWidth == 375) {
       NSInteger  index = kScreenWidth / 375;
        width = index;
        height = kScreenHeight / 667;
        
    } else if (kScreenWidth == 320) {
        width = kScreenWidth / 320;
        height = kScreenHeight / 568;
    } else if (kScreenWidth == 414){
        width = kScreenWidth / 414;
        height = kScreenHeight / 736;
    }
}

- (void)addView
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 70* height, 15 * width, 20 * height)];
    view.backgroundColor = [UIColor greenColor];
    [self addSubview:view];
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake((view.frame.size.width + 10) * width, 70 * height, 100 * width, 20 * height)];
    label.text = @"动手美食";
    label.font = [UIFont systemFontOfSize:15];
    [self addSubview:label];
#pragma mark -- 美食按钮
    self.footButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
    self.footButton.frame = CGRectMake(10 * width, (label.bottom + 10) *height, 50 * width, 50 * height) ;
#pragma mark - button变圆
    self.footButton.layer.cornerRadius = self.footButton.frame.size.height / 2.0;
    [self addSubview:self.footButton];
    self.footButton.backgroundColor = [UIColor redColor];
    self.footLabel = [[UILabel alloc] initWithFrame:CGRectMake(10 * width, (self.footButton.bottom + 10) * height, 50 * width, 20 * height)];
    self.footLabel.text = @"美食";
    self.footLabel.font = [UIFont systemFontOfSize:15];
    self.footLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.footLabel];
    
    // 乐趣
    UIView *leView = [[UIView alloc] initWithFrame:CGRectMake(10 * width, (self.footLabel.bottom + 5) *height, 15 * width, 20 * height)];
    leView.backgroundColor = [UIColor greenColor];
    [self addSubview:leView];
    UILabel *leLabel = [[UILabel alloc] initWithFrame:CGRectMake((leView.left + 20) * width, (self.footLabel.bottom + 5) *height, 100 * width, 20 * height)];
    leLabel.text = @"其他";
    leLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:leLabel];
    
}

#pragma  mark -- 
















@end
